﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceModel;
using System.Text;
using Host.Inject;
using ServiceDeclaration;

namespace Host
{
    class Program
    {
        private const string ServiceUrl = "http://localhost:1234/";
        static void Main()
        {
            var serviceUri = new Uri(ServiceUrl);
            var host = new ServiceHost(ContainerFactory.Current().Resolve<IApplicationService>(), serviceUri);
            host.Open();

            #region Output dispatchers listening

            foreach (var uri in host.BaseAddresses)
            {
                Console.WriteLine("\t{0}", uri);
            }
            Console.WriteLine();
            Console.WriteLine("Number of dispatchers listening : {0}", host.ChannelDispatchers.Count);
            foreach (System.ServiceModel.Dispatcher.ChannelDispatcher dispatcher in host.ChannelDispatchers)
            {
                Console.WriteLine("\t{0}, {1}", dispatcher.Listener.Uri, dispatcher.BindingName);
            }
            Console.WriteLine();
            Console.WriteLine("Press <ENTER> to terminate Host");
            Console.ReadLine();

            #endregion

        }
    }
}
